package com.example.animationex;

import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.view.Menu;
import android.view.animation.Animation;
import android.widget.ImageView;

public class DrawableAniActivity extends Activity {

	

	
	AnimationDrawable bangAnimation;
	
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		
		
		setContentView(R.layout.activity_drawable_ani);
		
		
		
		ImageView i = (ImageView)findViewById(R.id.imageView1);
		i.setBackgroundResource(R.drawable.ani_list);
		bangAnimation = (AnimationDrawable) i.getBackground();
		
		
		
	}
	
	
	
	

	@Override
	public void onWindowFocusChanged(boolean hasFocus) {
		
		bangAnimation.start();
		
		
		super.onWindowFocusChanged(hasFocus);
	}





	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.drawable_ani, menu);
		return true;
	}

}
